<div ng-if="unit.count().isZero() && unit.isCostMet()" ng-repeat="warn in (unit.warnfirst | filter:isWarningVisible)">
  <div class="alert alert-warning alert-dismissable animif" role="alert">
    <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
    <p>{{warn.text}}</p>
  </div>
</div>
<div class="form-group">
  <p>
    <form class="form-inline" ng-submit="commands.buyUnit({unit:unit, num:buyCount()})">
      <span class="titlecase">{{unit.unittype.verbing}}</span>
      <input focus-input type="text" ng-model="form.buyCount" placeholder="1" class="form-control"
title="'10%' buys 10% of the maximum you can afford.
'=1000' buys exactly 1,000 after accounting for twins, rounded up.
'@1000' buys the number needed to have a total of 1,000. If you already have 200, this will buy up to 800.
Numbers with suffixes work: '23 billion', '23b', or '23e9'.">
      {{buyCount().equals(1) ? unit.unittype.label : unit.unittype.plural}}
      <span ng-if="unit.twinMult().greaterThan(1)" ng-class="{strikethrough:false && form.buyCount.indexOf('=') >= 0}">(&times;{{unit.twinMult()|bignum}} twins)</span>
      will cost
      <cost costlist="unit.eachCost()" num="buyCount()"></cost>
    </form>
  </p>
  <p ng-if="options.showAdvancedUnitData()">
    <span ng-if="unit.maxCostMet().greaterThan(0)">
      <span class="titlecase">{{unit.unittype.verbing}}</span> your maximum of
      {{unit.maxCostMet().times(unit.twinMult())|longnum}} {{unit.maxCostMet().times(unit.twinMult()).equals(1) ? unit.unittype.label : unit.unittype.plural}}
    </span>
    <span ng-if="unit.maxCostMet().lessThanOrEqualTo(0)">
      <span class="titlecase">{{unit.unittype.verbing}}</span> your next {{unit.unittype.label}}
    </span>
    will cost
    <span ng-repeat="cost in unit.eachCost()">
      <span ng-if="!$first && $last"> and </span>
      <span>{{unitCostAsPercent(unit, cost) | percent:0}} of your {{cost.unit.unittype.plural}}</span><span ng-if="$last">.</span><span ng-if="!$last && unit.eachCost().length > 2">, </span>
    </span>
  </p>
  <p ng-if="options.showAdvancedUnitData() && unit.maxCostMetOfVelocity().greaterThan(0)">
    <span ng-if="unit.maxCostMetOfVelocity().times(unit.twinMult()).times(options.getVelocityUnit({unit:unit}).mult).greaterThanOrEqualTo(1)">
      You can {{unit.unittype.verb}} {{unit.maxCostMetOfVelocity().times(unit.twinMult()).times(options.getVelocityUnit({unit:unit}).mult)|longnum}} {{unit.maxCostMetOfVelocity().times(unit.twinMult()).times(options.getVelocityUnit({unit:unit}).mult).equals(1) ? unit.unittype.label : unit.unittype.plural}} every {{options.getVelocityUnit({unit:unit}).label}}, using
    </span>
    <span ng-if="unit.maxCostMetOfVelocity().times(unit.twinMult()).times(options.getVelocityUnit({unit:unit}).mult).lessThan(1)">
      You can {{unit.unittype.verb}} one {{unit.unittype.label}} every {{unit.maxCostMetOfVelocityReciprocal().dividedBy(unit.twinMult()).dividedBy(options.getVelocityUnit({unit:unit}).mult)|longnum}} {{unit.maxCostMetOfVelocityReciprocal().dividedBy(unit.twinMult()).dividedBy(options.getVelocityUnit({unit:unit}).mult).equals(1) ? options.getVelocityUnit({unit:unit}).label : options.getVelocityUnit({unit:unit}).plural}}, using
    </span>
    
    <span ng-repeat="cost in unit.eachCost()">
      <span ng-if="!$first && $last"> and </span>
      <span>{{unitCostAsPercentOfVelocity(unit, cost) | percent:0}} of your {{cost.unit.unittype.label}} income</span><span ng-if="$last">.</span><span ng-if="!$last && unit.eachCost().length > 2">, </span>
    </span>
  </p>
  <buyunit unit="unit" num="buyCount()"></buyunit>
</div>
